import App from './App'

import './public.css';
// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'
Vue.config.productionTip = false;
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// #endif

uni.addInterceptor('request', {
	invoke: (res) => {
		const openai = uni.getStorageSync('openid');
		if (openai) {
			res.header = {
				'access-token': openai
			}
		}
		res.url = `https://xy.axjing.com${res.url}`
	},
	success: (res) => {
		if (res.data?.code !== 0) {
			uni.showToast({
				icon: 'none',
				title: res.data?.msg ?? '请求异常'
			})
		}
	}
})

// #ifdef VUE3
import {
	createSSRApp
} from 'vue'
export function createApp() {
	const app = createSSRApp(App)
	return {
		app
	}
}
// #endif